$pointer: url('@/assets/images/Pointing.svg'), pointer;

.mainEdit {
  width: 500px;
  height: 100%;
  border-right: 1px solid rgba(172, 172, 172, 0.29);
  background: rgba(207, 207, 207, 0.05);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  .top {
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      line-height: 36px;
      .title {
        font-size: 20px;
        font-weight: 600;
      }
      .typeGroup {
        border-radius: 6px;
        padding: 2px;
        display: flex;
        gap: 10px;
        .typeItem {
          color: #fff;
          font-size: 14px;
          font-weight: 400;
          padding: 6px 9px;
        }
        :global(.semi-radio-addon-buttonRadio-checked) {
          background-color: rgba(49, 107, 255, 1);
        }
        :global(.semi-radio-buttonRadioGroup-small) {
          padding: 0;
        }
      }
    }
    .titleSection {
      margin: 8px 0 4px;
      line-height: 20px;
    }
    .area {
      border: 1px solid rgba(255, 255, 255, 0.2);
      background-color: rgba(23, 22, 26, 1);
      padding: 16px;
      border-radius: 4px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      max-height: 360px;
      flex: 1;
      position: relative;

      .tabs {
        display: flex;
        gap: 23px;
        color: rgba(255, 255, 255, 0.5);
        .noActive {
          line-height: 20px;
          padding-bottom: 10px;
          cursor: $pointer;
        }
        .isActive {
          line-height: 20px;
          padding-bottom: 10px;
          cursor: $pointer;
          border-bottom: 2px #fff solid;
        }
      }
      .uploadSection {
        flex: 1;
        background: rgba(100, 100, 100, 0.1);
        background-image: 
        /* 顶部 */ linear-gradient(
            to right,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            transparent 50%
          ),
          /* 右侧 */
            linear-gradient(
              to bottom,
              rgba(255, 255, 255, 0.2) 0%,
              rgba(255, 255, 255, 0.2) 50%,
              transparent 50%
            ),
          /* 底部 */
            linear-gradient(
              to left,
              rgba(255, 255, 255, 0.2) 0%,
              rgba(255, 255, 255, 0.2) 50%,
              transparent 50%
            ),
          /* 左侧 */
            linear-gradient(
              to top,
              rgba(255, 255, 255, 0.2) 0%,
              rgba(255, 255, 255, 0.2) 50%,
              transparent 50%
            );
        background-size: 10px 1px, /* 顶部虚线 */ 1px 10px, /* 右侧虚线 */ 10px 1px,
          /* 底部虚线 */ 1px 10px; /* 左侧虚线 */

        background-position: top left, /* 顶部位置 */ top right, /* 右侧位置 */ bottom left,
          /* 底部位置 */ top left; /* 左侧位置 */

        background-repeat: repeat-x, /* 顶部重复 */ repeat-y, /* 右侧重复 */ repeat-x,
          /* 底部重复 */ repeat-y; /* 左侧重复 */

        border-radius: 4px;
        .uploadPlaceholder {
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 12px;
          .uploadIcon {
            width: 18px;
            height: 18px;
            margin-bottom: 3px;
          }
          .uploadText {
            color: rgba(255, 255, 255, 0.5);
            font-size: 12px;
            line-height: 17px;
            cursor: default;
            span {
              color: rgba(249, 251, 252, 1);
              cursor: $pointer;
            }
          }
        }
      }
      .opts {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        .opt {
          display: flex;
          align-items: center;
          gap: 4px;
          cursor: $pointer;

          .text {
            font-size: 14px;
            font-weight: 400;
          }
        }
      }
      .img {
        cursor: $pointer;
        width: 20px;
        height: 20px;
      }
      :global(.semi-input-textarea-wrapper) {
        flex: 1;
        background-color: unset;
        border: none;
      }
      :global(.semi-input-textarea-wrapper-focus) {
        border: none;
      }
      :global(.semi-input-textarea) {
        height: 100%;
        padding: 0;
      }

      /* 上传参考音频 */
      .uploadBox {
        width: 100%;
        height: 100%;
        background-color: #17161a;

        :global(.arco-upload-trigger) {
          width: 100%;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          cursor: var(--pointer);

          .uploadBtn {
            width: 100%;

            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
          }
        }
      }

      .uploadAudioBox {
        width: 100%;
        height: 100%;
        background-color: #17161a;
        position: absolute;
        left: 0;
        top: 0;
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        border-radius: 4px;
        padding: 12px 24px;

        .item {
          width: 100%;
          height: 56px;
        }
      }
    }
    .saveBtn {
      // width: 180px;
      margin-left: 360px;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 4px;
    }
  }
  .bottom {
    height: 142px;
    --semi-border-radius-small: 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;

    &.configAudio {
      height: 142px;
    }

    .selectSection {
      flex-wrap: wrap;
      // height:32px;
      display: flex;
      gap: 12px;

      .configItem {
        flex: 1;
        color: rgba(255, 255, 255, 0.5);

        display: flex;
        justify-content: flex-start;
        align-items: center;

        &:first-child {
          flex-basis: 100%; /* 基础宽度为100% */
          width: 100%;
        }

        .configItemTitle {
          flex-basis: 80px;
        }
        .select {
          flex: 1;
          border: 1px solid var(--border-color);
          border-radius: 4px;
        }
        .voiceBtnSelect {
          background-color: #121212;

          :global(.semi-button-content){
            // width: 100%;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            text-align: left;
            width: 122px;
          }
          
          .voiceBtnSelectText {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            width: 100%;
            color: #ffffffcc;
            font-size: 14px;
            font-weight: 400;
            line-height: 22px;
          }
          .voiceBtnSelectIcon {
            transform: rotate(-90deg);
          }
        }
      }
    }
  }
  .middle {
    width: 100%;
    display: flex;
    justify-content: center;
    height: 48px;
  }
  .typeGroup {
    width: 324px;
    border-radius: 8px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;

    .typeItem {
      color: #fff;
      font-size: 14px;
      font-weight: 400;
      width: 110px;
      padding: 0;
      line-height: 34px;
    }
    :global(.semi-radio-addon-buttonRadio-checked) {
      background-color: #121317;
    }

    :global(.semi-radio-buttonRadioGroup-small) {
      padding: 0;
    }
    :global(.semi-radio-addon-buttonRadio-small) {
      border-radius: 8px !important;
    }
  }
  .moolBox, .delicacyBox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: 42px;
    transform: translateY(-13px);
    border-top: 0 none;
    .btn {
      font-weight: 400;
      color: rgba(255, 255, 255, 0.8);

      &:global(.semi-button-primary-disabled) {
        background: rgba(255, 255, 255, 0.2) !important;
        cursor: not-allowed;
      }
    }
    .delicacyBtn {
      height: 28px;

      :global(.semi-button-content) {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 4px;
      }
    }
    .delicacyIcon {
      transform: translateY(-1px);
    }
  }
}
.historyModal {
  :global(.semi-modal-header),
  :global(.semi-modal-footer) {
    padding: 0 24px;
  }
  :global(.semi-modal-content) {
    padding: 0;
    :global(.semi-modal-body) {
      overflow: auto;
      display: flex;
      justify-content: center;
      align-items: flex-start;
    }
  }
  .historyModalList {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    width: 1168px;
    max-height: 628px;
    .historyModalItem {
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 4px;
      width: 200px;
      height: 200px;
      overflow: hidden;
    }
    .img {
      width: 100%;
      height: 100%;
    }
  }
  .historyModalButton {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    .button {
      width: 100%;
    }
  }
}

// 新增的样式类，用于替换内联样式
.imageContainer {
  max-height: 140px;
  flex: 1;
  border: 1px solid rgba(68, 68, 72, 1);
  border-radius: 4px;
}

.submitButtonContainer {
  display: flex;
  justify-content: flex-end;
}

.submitButton {
  width: 170px;
  height: 40px;
}

.titleSectionMargin {
  margin: 0 0 -4px;
}

.referenceImageArea {
  max-height: 173px;
}

.referenceTextArea {
  max-height: 218px;
}

.toolbarContainer {
  height: 40px;
  border: 1px solid rgba(68, 68, 72, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.toolButton {
  width: 75px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  gap: 4px;
  cursor: $pointer;
  &:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

.toolButtonActive {
  width: 75px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  gap: 4px;
  cursor: $pointer;
}

/* Arco表单样式优化 */
.storyboardModalContent {
  padding: 10px 0;
}

.formLayout {
  .arco-form-item {
    margin-bottom: 0;
  }

  .arco-form-item-label {
    min-width: 100px;
  }

  .textArea {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgb(23, 22, 26);
  }
}

/* 调整Arco组件样式 */
:global(.arco-form-item) {
  margin-bottom: 0;
}

:global(.arco-select) {
  width: 100%;
}

:global(.arco-input-textarea) {
  width: 100%;
}


.voiceModalContent {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 16px;
  gap: 16px;

  .topToolColumn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
  }
  .typeTab {
    width: 320px;
    display: flex;
    justify-content: center;
    height: 48px;

    .typeGroup {
      width: 324px;
      border-radius: 8px;
      height: 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 24px;

      .typeItem {
        color: #fff;
        font-size: 14px;
        font-weight: 400;
        width: 110px;
        padding: 0;
        line-height: 34px;
      }
      :global(.semi-radio-addon-buttonRadio-checked) {
        background-color: #121317;
      }

      :global(.semi-radio-buttonRadioGroup-small) {
        padding: 0;
      }
      :global(.semi-radio-addon-buttonRadio-small) {
        border-radius: 8px !important;
      }
    }
  }
  .filterBox {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);

    .filterBtn {
      color: rgba(255, 255, 255, 0.8);
      font-weight: 400;
      padding: 4px 24px;
      border: 1px solid var(--border-color);

      &.filterBtnActive {
        border: 1px solid rgba(50, 109, 255, 1);
      }
    }
  }

  .soundListBox {
    width: 100%;
    flex: 1;
    max-height: 600px;
    overflow: auto;

    .soundCardItem {
      width: 140px;
      height: 168px;
      border-radius: 12px;
      border: 1px solid var(--border-color);
      padding: 24px;
      position: relative;
      // 添加卡片自身的过渡效果
      transition: border-color 0.3s ease;

      &.cardSelected {
        border: 1px solid rgba(49, 107, 255, 1);
        // 可以添加更多选中效果增强视觉反馈
        box-shadow: 0 0 0 2px rgba(49, 107, 255, 0.1);
      }

      :global(.semi-card-body) {
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
      }
      .soundAvatar {
        width: 88px;
        height: 88px;
      }

      // 文字容器样式
      .soundNameContainer {
        width: 90px; // 与Avatar宽度保持一致
        height: 22px;
        overflow: hidden;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        // 添加一些内边距，让文字在容器内有更好的呼吸空间
        padding: 0 2px;

        // 当文字溢出时应用动画
        &[data-overflow='true'] {
          .soundNameText {
            // 优化1：使用平滑的缓动函数替代linear
            // 优化2：调整动画持续时间，根据文字长度动态设置
            animation: scrollText 4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
            // 优化3：设置animation-fill-mode确保动画起始状态正确
            animation-fill-mode: both;
          }
          &:hover .soundNameText {
            animation-play-state: paused; // 鼠标悬停在文字上时暂停动画
          }
        }
      }

      .soundNameText {
        color: #fff;
        font-size: 14px;
        font-weight: 400;
        line-height: 22px;
        white-space: nowrap;
        display: inline-block;
        will-change: transform;
        position: relative;
        // 优化4：设置animation-play-state默认值
        animation-play-state: running;

        // 优化：使用绝对定位避免伪元素影响原始宽度
        &::after {
          content: attr(data-text);
          position: absolute;
          left: 100%;
          top: 0;
          padding-left: 10px;
          // 确保伪元素不会被测量
          pointer-events: none;
          // 优化6：确保伪元素与主文本样式一致
          color: inherit;
          font-size: inherit;
          font-weight: inherit;
          line-height: inherit;
        }
      }

      .soundName {
        color: #fff;
        font-size: 14px;
        font-weight: 400;
        line-height: 22px;
      }
      &:hover {
        border: 1px solid rgba(49, 107, 255, 1);
        .moreIcon {
          opacity: 1;
          transform: scale(1) translateY(0);
        }
      }
      .moreIcon {
        opacity: 0;
        transform: scale(0.8) translateY(-5px);
        // 延长过渡时间并使用更平滑的曲线
        transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
          transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        position: absolute;
        top: 4px;
        right: 4px;
        cursor: var(--pointer);
        // 添加一个小的z-index确保在卡片内容之上
        z-index: 10;
      }
    }
  }

  .audioPlayer {
    width: 100%;
    padding: 12px 0 0 0;
  }
}
